#include "Conversion.h"

Point_d Conversion::to_Point_d(vector<Conf> arr)
{
    std::vector< double > coord;
    int robot_num = arr.size();

    BOOST_FOREACH(Conf& point, arr){
        coord.push_back(point.x().exact().to_double());
        coord.push_back(point.y().exact().to_double());
    }
    Point_d point_d(robot_num * 2, coord.begin(), coord.end());

    return point_d;
}
vector<Conf> Conversion::to_vector(Point_d point_d)
{
    int robot_num = point_d.dimension() / 2;
    Point_d::Cartesian_const_iterator iter;
    vector<Conf> vec;

    for (iter = point_d.cartesian_begin(); iter != point_d.cartesian_end(); ++iter)
    {
        double x = *iter;
        ++iter;
        double y = *iter;
        Conf conf(x, y);
        vec.push_back(conf);
    }
    return vec;
}
